* Figure 1 -- vaccinated plus likely to vaccinate vs. hesitant *
use "KK_Vaccines_replication_data.dta", replace
gen vaxaccept_vs_hesitant = .
replace vaxaccept_vs_hesitant = 1 if vaccinated == 1
replace vaxaccept_vs_hesitant = 1 if vax_willingness == 3
replace vaxaccept_vs_hesitant = 1 if vax_willingness == 4
replace vaxaccept_vs_hesitant = 0 if vax_willingness == 1
replace vaxaccept_vs_hesitant = 0 if vax_willingness == 2
* t-tests referenced in text 8
gen severe = side4+side5
svy:reg severe vaxaccept_vs_hesitant
svy:reg side3 vaxaccept_vs_hesitant

gen trialbig = trial5+trial4
svy:reg trialbig vaxaccept_vs_hesitant

svy:reg has_live_virus vaxaccept_vs_hesitant
svy:reg no_live_virus vaxaccept_vs_hesitant

parmby "svy:mean side5 side4 side3 side2 side1 trial5 trial4 trial3 trial2 trial1  has_live_virus no_live_virus unsure_live_virus", norestore by(vaxaccept_vs_hesitant)
replace parmseq = parmseq+1 if parmseq>5
replace parmseq = parmseq+1 if parmseq>11
eclplot estimate min95 max95 parmseq, horizontal ylabel(0 "{bf:Side Effect Severity}"  5 "No side effects" 4 "Not at all severe" 3 "Not very severe" 2 "Somewhat severe" 1 "Severe" 6 "{bf:Estimated Trial Size}"  11 "1 to 1000" 10 "1001 to 10000" 9 "10001 to 25000" 8 "25001 to 50000" 7 "More than 50,000" 12 "{bf:Vaccine Beliefs}"  13 "Has live coronavirus" 14 "No live coronavirus" 15 "Unsure if live coronavirus", labsize(vsmall) notick nogrid) xlabel(0 "0%" .1 "10%" .2 "20%" .3 "30%" .4 "40%" .5 "50%" .6 "60%", labsize(vsmall)) ///
xti("") yti("") graphregion(color(white)) eplot(bar) ciopts(blcolor(black)) estopts(barwidth(0.4)) estopts1(bcolor(black)) estopts2(bcolor(gray)) supby(vaxaccept_vs_hesitant, spaceby(0.4)) 

* Table 2 *
use "KK_Vaccines_replication_data.dta", replace

gen trial_size_guess = COR7
recode trial_size_guess (77=.) (98=.)
svy: ologit side_effects dem5 gop5 female i.AGE4 education  black latino vaccinated
outreg2 using vaxtable2, word dec(2) label  2aster p side replace
outreg2 using vaxtable2, word dec(2) label  2aster ci side append
svy: ologit trial_size_guess dem5 gop5 female i.AGE4 education  black latino vaccinated
outreg2 using vaxtable2, word dec(2) label  2aster p side append
outreg2 using vaxtable2, word dec(2) label  2aster ci side append
svy: mlogit live_virus dem5 gop5 female i.AGE4 education  black latino vaccinated, base(3)
outreg2 using vaxtable2, word dec(2) label  2aster p side append
outreg2 using vaxtable2, word dec(2) label  2aster ci side append

* Table 3 *
svy:ologit vax_willingness trial_size side_effects has_live_virus  dem5 gop5 female ages2 ages3 ages4 education  black latino
outreg2 using vaxtable3, word dec(2) label append 2aster replace side p
outreg2 using vaxtable3, word dec(2) label append 2aster ci side
